package com.cskaoyan.javase.oop1._7exercise.pvz;

import java.awt.datatransfer.DataFlavor;

/**
 * 僵尸类
 * @since 11:27
 * @author wuguidong@cskaoyan.onaliyun.com
 */
public class Zombie {
    String name;
    int damageValue;
    int hp;
    int speed;

    // 持有植物对象的引用作为自身成员变量,方便交互
    Plant zombieP;


    // 构造器
    public Zombie(String name, int damageValue, int hp, int speed) {
        this.name = name;
        this.damageValue = damageValue;
        this.hp = hp;
        this.speed = speed;
    }

    public void move() {
        System.out.println(name + "正在以" + speed + "的速度,向" + zombieP.name + "移动!");
    }

    public void attack() {
        System.out.println(name + "正在攻击" + zombieP.name);
    }

    public void beAttacked() {
        System.out.println(name + "正在被" + zombieP.name + "攻击, 剩余" + (hp - zombieP.damageValue) + "点血量!");
    }

    public void eat() {
        System.out.println(name + "吃掉了你的脑子,真香!");
    }

}
